
/*
 * Copyright (C) 2008-2009 Archie L. Cobbs. All rights reserved.
 *
 * $Id: DetachedItemException.java 311 2010-02-08 23:40:32Z archie.cobbs $
 */

package org.dellroad.sidekar;

import org.dellroad.sidekar.util.SidekarException;

/**
 * Exception indicating an attempt to access a field of an {@link Item} which
 * has been detached (removed) from a Sidekar database.
 */
@SuppressWarnings("serial")
public class DetachedItemException extends SidekarException {

    protected final Item<?> item;

    public DetachedItemException(Item<?> item) {
        this.item = item;
    }

    public DetachedItemException(Item<?> item, String message) {
        super(message);
        this.item = item;
    }

    /**
     * Get the deleted {@link Item}.
     */
    public final Item<?> getItem() {
        return this.item;
    }
}

